home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / news / thor / rexx / reposten.thor < prev    next >
Text File  |  1998-05-24  |  3KB  |  128 lines

  1. /* $VER: RePostEN.thor 3.1 (2.9.94)
  2.  *
  3.  * Arexx script to repost messages from a BBS to conferences on another.
  4.  *
  5.  *  Script by: Eivind Nordseth, Ultima Thule Software.
  6.  */
  7.  
  8. options results
  9.  
  10. /* trace results */
  11.  
  12. EVE_ENTERMSG     =  0   /* Enter message */
  13.  
  14. if(substr(address(),1,4) ~= "THOR") then do
  15.     parse arg thorport
  16.     if~(show(p, thorport)) then do
  17.         if ~(show(p, "THOR.01")) then do
  18.             say "No THOR port found!"
  19.             exit
  20.         end
  21.         else thorport = "THOR.01"
  22.     end
  23. end
  24. else thorport = address()
  25.  
  26. if ~show('p', 'BBSREAD') then do
  27.     address command
  28.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  29.         "WaitForPort BBSREAD"
  30. end
  31.  
  32. address(thorport)
  33.  
  34. CURRENTMSG stem MSG
  35. if(rc ~= 0) then 
  36. do 
  37.     REQUESTNOTIFY TEXT '"No current message."' BT '"_Ok"'
  38.     exit
  39. end
  40.  
  41. address BBSREAD GETBBSLIST stem BBSLIST
  42. if(rc ~= 0) then 
  43. do
  44.     address(thorport)
  45.     REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  46.     exit
  47. end
  48.  
  49. REQUESTLIST instem BBSLIST outstem TOBBS title '"Select BBS to repost to"'
  50. if(rc ~= 0) then 
  51. do
  52.     if(rc ~= 5) then address(thorport) REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
  53.     exit
  54. end
  55.  
  56. dobbs = result
  57.  
  58. address BBSREAD GETCONFLIST bbsname '"'dobbs'"' stem CONFLIST
  59. if(rc ~= 0) then 
  60. do
  61.     address(thorport)
  62.     REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  63.     exit
  64. end
  65.  
  66. REQUESTLIST instem CONFLIST outstem TOCONF title '"Select Conference"'
  67. if(rc ~= 0) then 
  68. do
  69.     if(rc ~= 5) then address(thorport) REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
  70.     exit
  71. end
  72. doconf = result
  73.  
  74. address BBSREAD
  75.  
  76. UNIQUEMSGFILE bbsname '"'dobbs'"' stem UNIQUEFILE
  77. if(rc ~= 0) then 
  78. do
  79.     address(thorport)
  80.     REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  81.     exit
  82. end
  83.  
  84. READBRMESSAGE bbsname '"'MSG.BBSNAME'"' confname '"'MSG.CONFNAME'"' msgnr MSG.MSGNR headstem HEADTAGS textstem TEXTTAGS 
  85. if(rc ~= 0) then 
  86. do
  87.     address(thorport)
  88.     REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  89.     exit
  90. end
  91.  
  92. if(~open('fh',UNIQUEFILE.NAME,'Append')) then 
  93. do
  94.     address(thorport)
  95.     REQUESTNOTIFY TEXT '"Unable to open file:' UNIQUEFILE.NAME '"' BT '"_Ok"'
  96.     exit
  97. end
  98.  
  99. msgfrom = HEADTAGS.FROMNAME
  100. if symbol("HEADTAGS.FROMADDR") = "VAR" then msgfrom = msgfrom || ' <' || HEADTAGS.FROMADDR || '>'
  101.  
  102. call writeln('fh', 'Message crossposted from: ' || MSG.BBSNAME || ':' || MSG.CONFNAME)
  103. call writeln('fh', 'Originally written by: ' || msgfrom)
  104. call writeln('fh', 'Subject: ' || HEADTAGS.SUBJECT || '0a'x)
  105.  
  106. do n=1 to TEXTTAGS.TEXT.COUNT
  107.     call writeln('fh', TEXTTAGS.TEXT.n)
  108. end
  109.  
  110. call close('fh')
  111.  
  112.  
  113. drop EVENT.
  114.  
  115. EVENT.SUBJECT = HEADTAGS.SUBJECT
  116. EVENT.TONAME = 'ALL'
  117. EVENT.CONFERENCE = doconf
  118. EVENT.MSGFILE = UNIQUEFILE.FILEPART
  119.  
  120. WRITEBREVENT bbsname '"'dobbs'"' event EVE_ENTERMSG stem EVENT
  121. if(rc ~= 0) then 
  122. do
  123.     address(thorport)
  124.     REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  125.     exit
  126. end
  127.  
  128.